/*
 * CPassiveConnect.h
 *
 *  Created on: 2011-9-10
 *      Author: stargui
 */

#ifndef CPASSIVECONNECT_H_
#define CPASSIVECONNECT_H_
#include <map>
#include <string>
#include "CommonLibrary.h"
#include "../../SocketUtils/CPSocketUtils.h"
#include "../../Session/CSessionManager.h"
#include "CPassiveThread.h"
#include "ProtocolLabel.h"
#include "include/md5/md5.h"
#include "../../SocketUtils/CPSelectUtils.h"
using namespace Common;
using namespace PROTOCOL;
#define 	MAX_PASSIVE_THREADS		(1)

class CPassiveConnect
{
public:

	CPassiveConnect();

	virtual ~CPassiveConnect();

public:

	bool TaskSchedule();

	int SetServiceParameter(unsigned short listenPort);

	void SetClientNo(unsigned int no);

	void ResetPassiveNet();

private:

	CPassiveThread *GetMinimumLoads();

	void SetRelease();

private:

	int _listenTcpSocket;

	unsigned short _listenPort;

	int	_resetnet;

	CSessionManager *_sessionManager;

	CPassiveThread *_passiveThread[MAX_PASSIVE_THREADS];
};

#endif /* CPASSIVECONNECT_H_ */
